package com.md.youyouhui.net;


import android.arch.lifecycle.LiveData;

import com.md.youyouhui.net.response.CodeResponse;
import com.md.youyouhui.net.response.CouponAvailableResponse;
import com.md.youyouhui.net.response.CouponResponse;
import com.md.youyouhui.net.response.DirectPayResponse;
import com.md.youyouhui.net.response.GetAddressResponse;
import com.md.youyouhui.net.response.GetCardNumResponse;
import com.md.youyouhui.net.response.GetHomeMealNewResponse;
import com.md.youyouhui.net.response.GetHomeMealResponse;
import com.md.youyouhui.net.response.GetLimitSellResponse;
import com.md.youyouhui.net.response.GetOilInfoResponse;
import com.md.youyouhui.net.response.GetOrderInfoResponse;
import com.md.youyouhui.net.response.GetSellResponse;
import com.md.youyouhui.net.response.GetShoppingDetailsResponse;
import com.md.youyouhui.net.response.GetShoppingInfoResponse;
import com.md.youyouhui.net.response.GetSlideResponse;
import com.md.youyouhui.net.response.GetTypeResponse;
import com.md.youyouhui.net.response.HomeNewsResponse;
import com.md.youyouhui.net.response.IndexResponse;
import com.md.youyouhui.net.response.LoginResponse;
import com.md.youyouhui.net.response.NoticeResponse;
import com.md.youyouhui.net.response.OrderDetailResponse;
import com.md.youyouhui.net.response.OrderListResponse;
import com.md.youyouhui.net.response.PayMealResponse;
import com.md.youyouhui.net.response.QuestionResponse;
import com.md.youyouhui.net.response.RegisterResponse;
import com.md.youyouhui.net.response.ShowResponse;
import com.md.youyouhui.net.response.UserCardResponse;
import com.md.youyouhui.net.response.UserInfoResponse;

import java.util.List;

import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Query;

/**
 * Created by AdministratorZJ
 * on 2018/5/25.
 *
 * @author AdministratorZJ
 */

public interface ApiService {
    /**
     * 注册
     *
     * @param mobile
     * @param vcode
     * @param pwd
     * @return
     */
    @FormUrlEncoded
    @POST("account/register")
    LiveData<Result<RegisterResponse>> register(@Field("mobile") String mobile, @Field("vcode") String vcode, @Field("pwd") String pwd, @Field("source") String source, @Field("inviterNumber") String inviterNumber);

    /**
     * 发送验证码
     *
     * @param tel
     * @return
     */
    @FormUrlEncoded
    @POST("account/vcode")
    LiveData<Result<CodeResponse>> sendCode(@Field("tel") String tel);
    /**
     * 发送验证码
     *
     * @param tel
     * @return
     */
    @FormUrlEncoded
    @POST("account/v2/vcode")
    LiveData<Result<CodeResponse>> sendCodeV2(@Field("tel") String tel,@Field("token") String token,@Field("code") String code);

    /**
     * 注销账户
     * @return
     */
    @POST("account/logoutAccount")
    LiveData<Result<Object>> logoutAccount();


    /**
     * 登录
     *
     * @param type
     * @param mobile
     * @param vcode
     * @param pwd
     * @return
     */
    @FormUrlEncoded
    @POST("account/login")
    LiveData<Result<LoginResponse>> login(@Field("type") int type, @Field("mobile") String mobile, @Field("vcode") String vcode, @Field("pwd") String pwd, @Field("source") String source);
    /**
     * 忘记密码
     *
     * @param mobile
     * @param vcode
     * @param pwd
     * @return
     */
    @FormUrlEncoded
    @POST("account/forgot/pwd")
    LiveData<Result<Object>> forgot(@Field("mobile") String mobile, @Field("vcode") String vcode, @Field("pwd") String pwd);

    /**
     * 修改手机号
     *
     * @param mobile
     * @param vcode
     * @return
     */
    @FormUrlEncoded
    @POST("account/modify/mobile/phone")
    LiveData<Result<Object>> modifyPhone(@Field("mobile") String mobile, @Field("vcode") String vcode);

    /**
     * 邀请人
     *
     * @param registerMobilePhone
     * @param invitePhone
     * @return
     */
    @FormUrlEncoded
    @POST("account/fill/register/invitation")
    LiveData<Result<Object>> invitePeople(@Field("registerMobilePhone") String registerMobilePhone, @Field("invitePhone") String invitePhone);

    /**
     * 修改昵称
     *
     * @param nickName
     * @return
     */
    @FormUrlEncoded
    @POST("account/update/nickname")
    LiveData<Result<Object>> mobileName(@Field("nickName") String nickName);

    /**
     * 获取轮播图
     *
     * @param pageNum
     * @param pageSise
     * @return
     */
    @FormUrlEncoded
    @POST("slideshow/index")
    LiveData<Result<IndexResponse>> index(@Field("pageNum") int pageNum, @Field("pageSise") int pageSise);





    @POST("slideshow/show")
    LiveData<Result<ShowResponse>> show();

    /**
     * 新闻页
     *
     * @param pageNum
     * @param pageSise
     * @return
     */
    @FormUrlEncoded
    @POST("real/time/info/index")
    LiveData<Result<HomeNewsResponse>> getNews(@Field("pageNum") int pageNum, @Field("pageSise") int pageSise);

    /**
     * 问题列表
     *
     * @param pageNum
     * @param pageSise
     * @return
     */
    @FormUrlEncoded
    @POST("question/problems")
    LiveData<Result<QuestionResponse>> question(@Field("pageNum") int pageNum, @Field("pageSise") int pageSise);

    /**
     * 我的油卡
     *
     * @param pageNum
     * @param pageSise
     * @return
     */
    @FormUrlEncoded
    @POST("oil/card/oilCard")
    LiveData<Result<UserCardResponse>> getUserCard(@Field("pageNum") int pageNum, @Field("pageSise") int pageSise);

    /**
     * 绑定卡
     *
     * @param cardNo
     * @param mobile
     * @param name
     * @param type
     * @return
     */
    @FormUrlEncoded
    @POST("oil/card/bindOilCard")
    LiveData<Result<Object>> bindCard(@Field("cardNo") String cardNo, @Field("mobile") String mobile, @Field("name") String name, @Field("type") int type);

    /**
     * 删除卡
     *
     * @param id
     * @return
     */
    @FormUrlEncoded
    @POST("oil/card/unBindOilCard")
    LiveData<Result<Object>> delUserCard(@Field("id") String id);

    /**
     * 套餐
     *
     * @param pageNum
     * @param pageSise
     * @return
     */
    @FormUrlEncoded
    @POST("top/up/show/recharge")
    LiveData<Result<PayMealResponse>> payMeal(@Field("pageNum") int pageNum, @Field("pageSise") int pageSise);

    /**
     * 直冲
     *
     * @return
     */
    @POST("top/up/show/qb")
    LiveData<Result<List<DirectPayResponse>>> directPay();

    /**
     * 跑马灯
     *
     * @return
     */
    @POST("mall/notice")
    LiveData<Result<List<NoticeResponse>>> notice();

    /**
     * 优惠券
     *
     * @param pageNum
     * @param pageSise
     * @param status
     * @return
     */
    @FormUrlEncoded
    @POST("coupon/myCoupon")
    LiveData<Result<CouponResponse>> getCoupon(@Field("pageNum") int pageNum, @Field("pageSise") int pageSise, @Field("status") int status);

    /**
     * 获取用户信息
     *
     * @return
     */
    @POST("account/detail")
    LiveData<Result<UserInfoResponse>> getUserInfo();

    /**
     * 修改密码
     *
     * @param oldPwd
     * @param newPwd
     * @return
     */
    @FormUrlEncoded
    @POST("account/modifyPwd")
    LiveData<Result<Object>> mobilePwd(@Field("oldPwd") String oldPwd, @Field("newPwd") String newPwd);

    /**
     * 上传头像
     *
     * @param body
     * @return
     */
    @POST("account/upload/head")
    LiveData<Result<Object>> setUserHead(@Body RequestBody body);

    /**
     * 油卡数量
     *
     * @return
     */
    @POST("oil/card/gain/oilcard/num")
    LiveData<Result<GetCardNumResponse>> getCardNum();

    /**
     * 领取油卡
     *
     * @return
     */
    @FormUrlEncoded
    @POST("oil/card/card/apply")
    LiveData<Result<Object>> receiveCard(@Field("consignee") String consignee, @Field("mobilePhone") String mobilePhone, @Field("area") String area,
                                         @Field("detailedAddress") String detailedAddress, @Field("postcode") String postcode, @Field("type") int type,
                                         @Field("rechargeId") String rechargeId, @Field("couponId") String couponId, @Field("monthly") int monthly,
                                         @Field("totalPayAmount") String totalPayAmount, @Field("payType") String payType);

    /**
     * 获取可用优惠券
     *
     * @param rechargeId
     * @param usedAmount
     * @return
     */
    @FormUrlEncoded
    @POST("coupon/gain/usable/coupon")
    LiveData<Result<List<CouponAvailableResponse>>> couponAvailable(@Field("rechargeId") String rechargeId, @Field("usedAmount") String usedAmount);

    /**
     * 直接充油卡
     *
     * @param qbId
     * @param totalPayment
     * @param accountOilCardId
     * @param accountCouponId
     * @param payType
     * @return
     */
    @FormUrlEncoded
    @POST("top/up/oil/ccard/qb")
    LiveData<Result<Object>> payMoney(@Field("qbId") String qbId, @Field("totalPayment") String totalPayment,
                                      @Field("accountOilCardId") String accountOilCardId, @Field("accountCouponId") String accountCouponId,
                                      @Field("payType") String payType);

    /**
     * 套餐充值
     *
     * @param rechargeId
     * @param totalPayment
     * @param accountOilCardId
     * @param accountCouponId
     * @param payType
     * @return
     */
    @FormUrlEncoded
    @POST("top/up/oil/ccard/recharge")
    LiveData<Result<Object>> payMoneyMeal(@Field("rechargeId") String rechargeId, @Field("totalPayment") String totalPayment,
                                          @Field("monthly") int monthly,
                                          @Field("accountOilCardId") String accountOilCardId, @Field("accountCouponId") String accountCouponId,
                                          @Field("payType") String payType);

    /**
     * 获取套餐
     *
     * @return
     */
    @POST("top/up/fixed/recharge")
    LiveData<Result<GetHomeMealResponse>> getHomeMeal();

    /**
     * 获取套餐
     *
     * @return
     */
    @POST("top/up/new/fixed/recharge")
    LiveData<Result<List<GetHomeMealNewResponse>>> getHomeMealNew();

    /**
     * 获取套餐详情
     *
     * @return
     */
    @GET("order/account/oilcard/order")
    LiveData<Result<List<GetOrderInfoResponse>>> getOrderInfo(@Query("stateType") String orderType);

    /**
     * 获取套餐详情
     *
     * @return
     */
    @GET("order/account/oilcard/order/details")
    LiveData<Result<OrderDetailResponse>> getOrderInfoDetail(@Query("orderId") String orderId, @Query("orderType") String orderType);

    /**
     * 获取油价
     *
     * @param city
     * @return
     */
    @FormUrlEncoded
    @POST("oil/card/today/oil/price")
    LiveData<Result<GetOilInfoResponse>> getOilInfo(@Field("city") String city);

    /**
     * 获取商城类型
     *
     * @return
     */
    @POST("mall/category")
    LiveData<Result<List<GetTypeResponse>>> getShoppingType();

    /**
     * 获取轮播图
     *
     * @return
     */
    @POST("mall/slideshow")
    LiveData<Result<List<GetSlideResponse>>> getSlide();

    /**
     * 获取热销商品
     *
     * @return
     */
    @POST("mall/sell/column")
    LiveData<Result<List<GetSellResponse>>> getShoppingSell();

    /**
     * 获取限时热销商品
     *
     * @return
     */
    @POST("mall/time/limit/sell")
    LiveData<Result<List<GetLimitSellResponse>>> getShoppingLimitSell();

    /**
     * 获取分类商品
     *
     * @return
     */
    @FormUrlEncoded
    @POST("mall/goods/info")
    LiveData<Result<List<GetShoppingInfoResponse>>> getShoppingInfo(@Field("categoryId") String categoryId);

    /**
     * 获取商品详情
     *
     * @param categoryId
     * @return
     */
    @FormUrlEncoded
    @POST("mall/goods/info/details")
    LiveData<Result<GetShoppingDetailsResponse>> getShoppingDetails(@Field("id") String categoryId);

    /**
     * 添加地址
     *
     * @param consignee
     * @param mobilePhone
     * @param area
     * @param detailedAddress
     * @param postcode
     * @param tag
     * @return
     */
    @FormUrlEncoded
    @POST("address/add/update")
    LiveData<Result<Object>> addAddress(@Field("id") String id, @Field("consignee") String consignee, @Field("mobilePhone") String mobilePhone,
                                        @Field("area") String area,
                                        @Field("detailedAddress") String detailedAddress, @Field("postcode") String postcode,
                                        @Field("tag") String tag);

    /**
     * 获取地址
     *
     * @return
     */
    @POST("address/gain")
    LiveData<Result<List<GetAddressResponse>>> getAddress();

    /**
     * 删除地址
     *
     * @param id
     * @return
     */
    @FormUrlEncoded
    @POST("address/del")
    LiveData<Result<Object>> delAddress(@Field("id") String id);

    /**
     * 获取默认地址
     *
     * @return
     */
    @POST("address/gain/default")
    LiveData<Result<GetAddressResponse>> getDefaultAddress();

    /**
     * 商品支付
     *
     * @param giId
     * @param addressId
     * @param payType
     * @return
     */
    @FormUrlEncoded
    @POST("mall/pay")
    LiveData<Result<Object>> shoppingPay(@Field("giId") String giId, @Field("addressId") String addressId, @Field("payType") String payType);

    /**
     * 获取商品油卡订单
     *
     * @param type
     * @param statusType
     * @return
     */
    @FormUrlEncoded
    @POST("mall/orders")
    LiveData<Result<List<OrderListResponse>>> getShoppingOrders(@Field("type") String type, @Field("statusType") String statusType);

    /**
     * 确认收货
     *
     * @param orderId
     * @return
     */
    @FormUrlEncoded
    @POST("mall/confirm")
    LiveData<Result<Object>> orderConfrim(@Field("type") String type, @Field("orderId") String orderId);
}
